<html>
<head><meta charset="utf-8"><title>Runnables · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html">Runnables</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="199484008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199484008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199484008">(Jun 02 2020 at 12:35)</a>:</h4>
<p>I'd say "running" runnables should be left to the client</p>



<a name="199484050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199484050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199484050">(Jun 02 2020 at 12:35)</a>:</h4>
<p>Which could draw test results in a smart way, or start a debug session or what not</p>



<a name="199484574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199484574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199484574">(Jun 02 2020 at 12:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133169">matklad</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/weekly.20sync-up/near/199484008">said</a>:</p>
<blockquote>
<p>I'd say "running" runnables should be left to the client</p>
</blockquote>
<p>to run a runnable we need a compilation artifact, i.e. we need to know how to build it. And this is a main problem. I think a client should not know how to build the artifact, just be able to run it.</p>



<a name="199484613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199484613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199484613">(Jun 02 2020 at 12:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="203366">Jeremy Kolb</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/weekly.20sync-up/near/199483159">said</a>:</p>
<blockquote>
<p>@vsrs I think there's some truth to that. It would be nice if we could provide some sort of standard "debugger engine hooks" or conform to some standard "test adapter api" for those types of things.</p>
</blockquote>
<p>There is <a href="https://build-server-protocol.github.io/">https://build-server-protocol.github.io/</a>, but I do not like how it works.</p>



<a name="199484632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199484632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199484632">(Jun 02 2020 at 12:40)</a>:</h4>
<p>Not sure, I think building artifact should also be a responsibility of the client. I think we shouldn't really assume any specific build system</p>



<a name="199484701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199484701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199484701">(Jun 02 2020 at 12:41)</a>:</h4>
<p><span class="user-mention" data-user-id="298653">@vsrs</span> <span class="user-mention" data-user-id="203366">@Jeremy Kolb</span> splited the topic here</p>



<a name="199484814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199484814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199484814">(Jun 02 2020 at 12:42)</a>:</h4>
<blockquote>
<p>Not sure, I think building artifact should also be a responsibility of the client</p>
</blockquote>
<p>The reasoning is that the user should have direct access to the processes being run (ie, they should see stdout/stderrr and a button to kill a runaway process). It seems this is best handled by the client</p>



<a name="199484832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199484832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199484832">(Jun 02 2020 at 12:42)</a>:</h4>
<p>Than much more logic will be on the client side. And each client should implement it from scratch.</p>



<a name="199485008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199485008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199485008">(Jun 02 2020 at 12:44)</a>:</h4>
<p>That's true, but I also think that this is how it should work, sadly. Different clients have different UXes for runnning external processes, and I think an ideal language plugin should leverage those uxes,</p>



<a name="199485090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199485090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199485090">(Jun 02 2020 at 12:44)</a>:</h4>
<p>Well, I can also imagine some generic "process handler" on the protocl level, but that goes beyond just running...</p>



<a name="199485244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199485244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199485244">(Jun 02 2020 at 12:46)</a>:</h4>
<p>Make sense. Maybe then it worth to have a set of commands implemented on the client side (build, run, debug) and a way the client can let server know about this commands, so the server can use them?</p>



<a name="199485338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199485338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199485338">(Jun 02 2020 at 12:46)</a>:</h4>
<p>The two specific problems I am thinking about are:</p>
<ul>
<li>For debugging, when we run <code>cargo build --message-format=json</code>, the user should see the stderr of this process</li>
<li>When the code is build with, eg, Buck, and not Cargo, we should still draw a <code>Run</code> button on a <code>#[test]</code> function, but let the actual executing to somethng else</li>
</ul>



<a name="199485547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199485547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199485547">(Jun 02 2020 at 12:48)</a>:</h4>
<p>Ideally,  there should be second-order client plugins. For example, one can imagine a plugin to run a <code>test</code> under <code>miri</code> or under some code coverage tracking tool. These plugins should be implementable without changing code inside rust-analyze</p>



<a name="199486065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199486065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199486065">(Jun 02 2020 at 12:52)</a>:</h4>
<p><span class="user-mention silent" data-user-id="298653">vsrs</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Runnables/near/199484613">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="203366">Jeremy Kolb</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/weekly.20sync-up/near/199483159">said</a>:</p>
<blockquote>
<p>@vsrs I think there's some truth to that. It would be nice if we could provide some sort of standard "debugger engine hooks" or conform to some standard "test adapter api" for those types of things.</p>
</blockquote>
<p>There is <a href="https://build-server-protocol.github.io/">https://build-server-protocol.github.io/</a>, but I do not like how it works.</p>
</blockquote>
<p>FYI I kind of asked about this: <a href="https://github.com/build-server-protocol/build-server-protocol/issues/120">https://github.com/build-server-protocol/build-server-protocol/issues/120</a></p>



<a name="199486359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199486359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199486359">(Jun 02 2020 at 12:54)</a>:</h4>
<p><span class="user-mention" data-user-id="298653">@vsrs</span> do you know if it would be possible to provide extension API on the VS Code side?</p>



<a name="199486396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199486396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199486396">(Jun 02 2020 at 12:54)</a>:</h4>
<p>May be then we should replace Runnable <code>bin</code> field with something like <code>type</code>?  So the client can interpret it and do the appropriate actions. Not just merely pass it to a shell.</p>



<a name="199486404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199486404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199486404">(Jun 02 2020 at 12:54)</a>:</h4>
<p>Like, to maybe move debugger integrations outside ?</p>



<a name="199486427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199486427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199486427">(Jun 02 2020 at 12:55)</a>:</h4>
<p><span class="user-mention" data-user-id="298653">@vsrs</span> that's exactly what I want to do yeah</p>



<a name="199486435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199486435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199486435">(Jun 02 2020 at 12:55)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133169">matklad</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Runnables/near/199486359">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="298653">vsrs</span> do you know if it would be possible to provide extension API on the VS Code side?</p>
</blockquote>
<p>I'm not sure what are you talking about.</p>



<a name="199486565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199486565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199486565">(Jun 02 2020 at 12:56)</a>:</h4>
<p>More specifically, I want to provide two views of runnable on the LSP layer:</p>
<div class="codehilite"><pre><span></span><code>runnable {
   &quot;cargo&quot;: { &quot;package&quot;: &quot;foo&quot;, &quot;target&quot;: &quot;bar&quot; ... }
    &quot;process&quot;: {&quot;bin&quot;: &quot;cargo&quot;, &quot;args&quot;: []}
}
</code></pre></div>



<a name="199486605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199486605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199486605">(Jun 02 2020 at 12:56)</a>:</h4>
<p>So that smart clients can intercept cargo and plugin debugging inside</p>



<a name="199486625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199486625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199486625">(Jun 02 2020 at 12:56)</a>:</h4>
<p>And dumb clients can just run a preconfigured process</p>



<a name="199486722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199486722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199486722">(Jun 02 2020 at 12:57)</a>:</h4>
<blockquote>
<p>I'm not sure what are you talking about.</p>
</blockquote>
<p>Yeah, bad wording on my side. I guess, I am asking this: can someone write a VS Code extension, which would depend on <code>rust-analyzer</code> extensions, and would be able to use rust-analzyer's runnables?</p>



<a name="199486744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199486744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199486744">(Jun 02 2020 at 12:57)</a>:</h4>
<p>Basically, can one extension call functions from another extensions?</p>



<a name="199487023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199487023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199487023">(Jun 02 2020 at 12:59)</a>:</h4>
<blockquote>
<p>And dumb clients can just run a preconfigured process</p>
</blockquote>
<p>Anyway a client have to support LSP extention, so why not to support <code>cargo</code>... too. Not sure that we need <code>process</code>.</p>



<a name="199487249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199487249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199487249">(Jun 02 2020 at 13:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133169">matklad</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Runnables/near/199486722">said</a>:</p>
<blockquote>
<p>I guess, I am asking this: can someone write a VS Code extension, which would depend on <code>rust-analyzer</code> extensions, and would be able to use rust-analzyer's runnables?</p>
</blockquote>
<p>Yes, I think it is possible. Just not sure it is the best way to go.</p>



<a name="199487775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199487775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199487775">(Jun 02 2020 at 13:05)</a>:</h4>
<p>A side question. Is it possible to run several tests with cargo?<br>
something like <code>cargo pkg::test1_explicit_name pkg::test2_explicit_name</code>, etc..</p>



<a name="199488023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199488023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199488023">(Jun 02 2020 at 13:07)</a>:</h4>
<p><span class="user-mention" data-user-id="298653">@vsrs</span> not at the moment I think</p>



<a name="199488102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199488102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199488102">(Jun 02 2020 at 13:08)</a>:</h4>
<p>You can filter by test name prefix, but not by arbitrary set of tests</p>



<a name="199488132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199488132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199488132">(Jun 02 2020 at 13:08)</a>:</h4>
<p>There's a long-standing issue on Cargo to allow that (from IntelliJ days)</p>



<a name="199488141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199488141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199488141">(Jun 02 2020 at 13:08)</a>:</h4>
<p>:(</p>



<a name="199488206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199488206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199488206">(Jun 02 2020 at 13:09)</a>:</h4>
<p>Hm, yeah, this is really tough :(</p>



<a name="199488238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199488238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199488238">(Jun 02 2020 at 13:09)</a>:</h4>
<p>Who should do <code> m.insert("RUST_BACKTRACE".to_string(), "short".to_string());</code> ? Client? Or the Server?</p>



<a name="199488388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199488388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199488388">(Jun 02 2020 at 13:10)</a>:</h4>
<p>Thanks.</p>
<p>I need this to implement <code>Run all tests</code> <a href="/user_uploads/4715/zJ4VygjV1nofNk6DfCVkN80_/test_lens.gif">test_lens.gif</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/zJ4VygjV1nofNk6DfCVkN80_/test_lens.gif" title="test_lens.gif"><img src="/user_uploads/4715/zJ4VygjV1nofNk6DfCVkN80_/test_lens.gif"></a></div>



<a name="199488625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199488625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199488625">(Jun 02 2020 at 13:12)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133169">matklad</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Runnables/near/199488238">said</a>:</p>
<blockquote>
<p>Who should do <code> m.insert("RUST_BACKTRACE".to_string(), "short".to_string());</code> ? Client? Or the Server?</p>
</blockquote>
<p>I thinks someone who knows the build context. So looks like it should be client (if he is responsible for building)</p>



<a name="199488817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199488817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199488817">(Jun 02 2020 at 13:14)</a>:</h4>
<p>Yeah, I think this probably makes sense</p>



<a name="199489133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199489133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199489133">(Jun 02 2020 at 13:17)</a>:</h4>
<p>And what if supply RA as an extension bundle: rust-analyzer itself and a cargo-based additional extension responsible for lenses, build targets, etc. I've just checked there no problem using ra commands from withing another extension.</p>



<a name="199489317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199489317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199489317">(Jun 02 2020 at 13:18)</a>:</h4>
<p><span class="user-mention" data-user-id="298653">@vsrs</span> how does the following look to you?</p>
<div class="codehilite"><pre><span></span><code>#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = &quot;camelCase&quot;)]
pub struct Runnable {
    pub range: Range,
    pub label: String,
    pub kind: RunnableKind,
    pub args: CargoRunnable,
}

#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = &quot;lowercase&quot;)]
pub enum RunnableKind {
    Cargo,
}

struct CargoRunnable {
    cargo_toml: PathBuf,
    command: String,
    // --package and --lib stuff
    cargo_args: Vec&lt;String&gt;,
    // stuff after --
    executable_args: Vec&lt;String&gt;,
}
</code></pre></div>



<a name="199489810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199489810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199489810">(Jun 02 2020 at 13:23)</a>:</h4>
<p>I would add <code>pub name_range: TextRange</code> to Runnable. To reference a test in UI, for example. or maybe 'navigation_range'</p>



<a name="199490143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199490143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199490143">(Jun 02 2020 at 13:25)</a>:</h4>
<p>I think that should be <code>target_range</code> (with possible addion of <code>target_selection_range</code> later)</p>



<a name="199490177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199490177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199490177">(Jun 02 2020 at 13:25)</a>:</h4>
<p>Maybe we should just use <code>LocationLink</code> here even...</p>



<a name="199490799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199490799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199490799">(Jun 02 2020 at 13:30)</a>:</h4>
<p>Sorry, I messed up the types. Of course in LSP it is Range or (better) Location.</p>



<a name="199491370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199491370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199491370">(Jun 02 2020 at 13:35)</a>:</h4>
<p>Ah, so you think its importrant that we have <em>both</em> the full range and name range?</p>



<a name="199491408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199491408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199491408">(Jun 02 2020 at 13:35)</a>:</h4>
<p>That seams reasonable, should just plug LocationLink in there then</p>



<a name="199491675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199491675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199491675">(Jun 02 2020 at 13:37)</a>:</h4>
<p>Yes, definitely. You can look at the gif above. When I hit <code>5 tests</code> I need name range to show references to tests</p>



<a name="199492099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199492099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199492099">(Jun 02 2020 at 13:41)</a>:</h4>
<p>LocationLink may not be necessary. There is no origin in this case. Simple Location looks better for me.</p>



<a name="199492170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199492170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199492170">(Jun 02 2020 at 13:42)</a>:</h4>
<p>But <code>Location</code> has only one range</p>



<a name="199492233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199492233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199492233">(Jun 02 2020 at 13:42)</a>:</h4>
<p>I think we need range of the whole function, as well as the range of identifier</p>



<a name="199492637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199492637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199492637">(Jun 02 2020 at 13:45)</a>:</h4>
<p>Ups, I thought you want to leave existing range field and <strong>add</strong> LocationLink to a name.</p>
<p>Yes, I'm +1 for the single LocationLink :)</p>



<a name="199506433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199506433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199506433">(Jun 02 2020 at 15:09)</a>:</h4>
<p>Hm, one wrinkle here is that code-lens are implemented on the server...</p>



<a name="199506575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199506575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199506575">(Jun 02 2020 at 15:10)</a>:</h4>
<p>I wonder if we should move them to the client-side instead... They need custom commands anyway...</p>



<a name="199510498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199510498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199510498">(Jun 02 2020 at 15:33)</a>:</h4>
<p>Why not pass the list of supported commands to the server during initialization? As sort of client capabilities.</p>



<a name="199510762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199510762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199510762">(Jun 02 2020 at 15:35)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/pull/4710/files">https://github.com/rust-analyzer/rust-analyzer/pull/4710/files</a></p>



<a name="199512421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Runnables/near/199512421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vsrs <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Runnables.html#199512421">(Jun 02 2020 at 15:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="298653">vsrs</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Runnables/near/199510498">said</a>:</p>
<blockquote>
<p>Why not pass the list of supported commands to the server during initialization? As sort of client capabilities.</p>
</blockquote>
<p>Though.. it's not a good idea. It's better to leave all the logic on one side. The client - ok let it be.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>